﻿using DotNetCore.CAP;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace TestSysApi.Controllers
{
    /// <summary>
    /// PlmController
    /// </summary>
    [Route("Sys/[controller]/[action]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private readonly ICapPublisher _capPublisher;

        public TestController(ICapPublisher capPublisher)
        {
            this._capPublisher = capPublisher;
        }
        /// <summary>
        /// Get接口
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ActionResult<IEnumerable<string>> GetIds()
        {
            _capPublisher.Publish("services.sysapi.show.time", DateTime.Now);
            return new string[] { "sys_id1", "sys_id2" };
        }

        /// <summary>
        /// Post接口
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public ActionResult<string> PostSomething(string param)
        {
            return "sys_PostResult:" + param;
        }
    }
}
